﻿Imports System.Globalization
Imports System.Threading
Imports System.ComponentModel

Public Class Overlay

    Dim homepath As String = Application.UserAppDataPath & "\Overlay"
    Dim userinfo As String = homepath & "\user.ini"
    Dim colorinfo As String = homepath & "\color.ini"
    Dim appinfo As String = homepath & "\appinfo.ini"
    Dim locked As Boolean = True

    Private Declare Function ReleaseCapture Lib "user32" () As Integer
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
        ByVal hwnd As Integer, _
        ByVal wMsg As Integer, _
        ByVal wParam As Integer, _
        ByRef lParam As Object) As Integer

    Private Const HTCAPTION As Short = 2
    Private Const WM_NCLBUTTONDOWN As Short = &HA1S
    Private Const WM_SYSCOMMAND As Short = &H112S

    'Start
    Private Sub Overlay_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer = 1
        While i > 0
            If ReadLine(userinfo, i) <> "" Then
                ComboBox1.Items.Add(ReadLine(userinfo, i))
                i = i + 1
            Else
                i = 0
            End If
        End While

        If ReadLine(appinfo, 2) <> "" Then
            Me.BackgroundImage = System.Drawing.Image.FromFile(ReadLine(appinfo, 2))
        End If

        Dim splitted() As String

        'Form
        splitted = Split(ReadLine(appinfo, 3), ",")
        size_custom(splitted(0), splitted(1))

        splitted = Split(ReadLine(appinfo, 4), ",")
        Me.Location = New Point(splitted(0), splitted(1))

        Me.Opacity = ReadLine(appinfo, 9)
    End Sub

    Private Sub Overlay_Closing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.FormClosing
        'Form
        EditLine(appinfo, Me.Size.Width & "," & Me.Size.Height, 3)
        EditLine(appinfo, Me.Location.X & "," & Me.Location.Y, 4)

        'Player1
        EditLine(appinfo, Label1.Location.X & "," & Label1.Location.Y, 5)
        EditLine(appinfo, Label1.Height - 6, 14) 'Font-size

        'Player2
        EditLine(appinfo, Label2.Location.X & "," & Label2.Location.Y, 6)
        EditLine(appinfo, Label2.Height - 6, 15) 'Font-size

        'Colorpick left
        EditLine(appinfo, Button1.Location.X & "," & Button1.Location.Y, 7)
        EditLine(appinfo, Button1.Size.Width, 16) 'Button-size

        'Colorpick right
        EditLine(appinfo, Button2.Location.X & "," & Button2.Location.Y, 8)
        EditLine(appinfo, Button2.Size.Width, 17) 'Button-size

        'Racepick left/right
        'EditLine(appinfo, Button3.Location.X & "," & Button3.Location.Y, 9)
        'EditLine(appinfo, Button4.Location.X & "," & Button4.Location.Y, 10)
        'Opacity
        EditLine(appinfo, Me.Opacity, 9)

        'Points
        EditLine(appinfo, Label3.Location.X & "," & Label3.Location.Y, 11)
        EditLine(appinfo, Label4.Location.X & "," & Label4.Location.Y, 12)
        EditLine(appinfo, Label4.Height - 6, 18) 'Font-size

        EditLine(appinfo, Label5.Location.X & "," & Label5.Location.Y, 13)
    End Sub

    'Wenn Form nicht gelockt, dann verschiebbar.
    Private Sub Overlay_MouseDown( _
        ByVal eventSender As System.Object, _
        ByVal eventArgs As System.Windows.Forms.MouseEventArgs) _
        Handles Me.MouseDown

        If Not (locked) Then
            ReleaseCapture()
            SendMessage(Me.Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
        End If
    End Sub

#Region "Funktionen"
    Sub panel_all_hidden()
        Panel1.Visible = False
        TextBox1.Visible = False
        Button5.Visible = False
        Button7.Visible = False
        Button8.Visible = False
        Button9.Visible = False
        Button10.Visible = False
        Button11.Visible = False
        Button12.Visible = False
        Button13.Visible = False
        Button14.Visible = False
        ComboBox1.Visible = False
        Button6.Visible = False
        TextBox1.Text = ""
    End Sub
    Sub name_write()
        Dim i As Integer = 1
        If TextBox1.Text <> "" Then
            Select Case Label6.Text
                Case "Name Player 1:"
                    Label1.Text = TextBox1.Text
                    AddLine(userinfo, TextBox1.Text)
                    AddLine(colorinfo, "")
                    Button3.ContextMenuStrip = ContextMenuStrip1
                Case "Name Player 2:"
                    Label2.Text = TextBox1.Text
                    AddLine(userinfo, TextBox1.Text)
                    AddLine(colorinfo, "")
                    Button4.ContextMenuStrip = ContextMenuStrip2
            End Select
            TextBox1.Text = ""
        End If

        ComboBox1.Items.Clear()
        While i > 0
            If ReadLine(userinfo, i) <> "" Then
                ComboBox1.Items.Add(ReadLine(userinfo, i))
                i = i + 1
            Else
                i = 0
            End If
        End While
    End Sub
    
    Sub size_small()
        Me.Size = New Size(500, 50)
        Label1.Location = New Point(88, 17)
        Label1.Font = New Font(Label1.Font.Name, 12, Label1.Font.Style)

        Label2.Location = New Point(329, 17)
        Label2.Font = New Font(Label2.Font.Name, 12, Label2.Font.Style)

        Label3.Location = New Point(Me.Size.Width / 2 - Label3.Size.Width / 2, 5)
        Label4.Font = New Font(Label4.Font.Name, 9.75, Label4.Font.Style)
        Label4.Location = New Point(Label3.Location.X - Label4.Size.Width \ 2, Label3.Location.Y + Label3.Height)
        Label5.Font = New Font(Label5.Font.Name, 9.75, Label5.Font.Style)
        Label5.Location = New Point(Label3.Location.X + Label3.Width - Label5.Size.Width \ 2, Label3.Location.Y + Label3.Height)

        Button1.Location = New Point(57, 13)
        Button1.Size = New Size(25, 25)

        Button2.Location = New Point(419, 13)
        Button2.Size = New Size(25, 25)

        Button3.Location = New Point(0, 0)
        Button3.Size = New Size(50, 50)

        Button4.Size = New Size(50, 50)
        Button4.Location = New Point(Me.Size.Width - 50, 0)
    End Sub
    Sub size_big()
        Me.Size = New Size(735, 70)

        Label1.Location = New Point(120, Me.Size.Height / 2 - 15)
        Label1.Font = New Font(Label1.Font.Name, 15, Label1.Font.Style)

        Label2.Location = New Point(Me.Size.Width - 230, Me.Size.Height / 2 - 15)
        Label2.Font = New Font(Label2.Font.Name, 15, Label2.Font.Style)

        Label3.Location = New Point(Me.Size.Width / 2 - Label3.Size.Width / 2, 10)
        Label4.Font = New Font(Label4.Font.Name, 18, Label4.Font.Style)
        Label4.Location = New Point(Label3.Location.X - Label4.Size.Width \ 2, Label3.Location.Y + Label3.Height)
        Label5.Font = New Font(Label5.Font.Name, 18, Label5.Font.Style)
        Label5.Location = New Point(Label3.Location.X + Label3.Width - Label5.Size.Width \ 2, Label3.Location.Y + Label3.Height)

        Button1.Size = New Size(40, 40)
        Button1.Location = New Point(75, 14)

        Button2.Size = New Size(40, 40)
        Button2.Location = New Point(Me.Size.Width - 115, 14)


        Button3.Location = New Point(0, 0)
        Button3.Size = New Size(70, 70)
        Button4.Location = New Point(Me.Size.Width - 68, 0)
        Button4.Size = New Size(70, 70)
    End Sub

    Sub size_custom(ByVal x As Integer, ByVal y As Integer)
        Me.Size = New Size(x, y)

        'Left
        Button3.Location = New Point(0, 0)
        Button3.Size = New Size(y, y)

        Button1.Size = New Size(y * 0.59, y * 0.59)
        Button1.Location = New Point(y + 7, Me.Size.Height / 2 - Button1.Size.Height / 2)

        Label1.Font = New Font(Label1.Font.Name, CUInt(Math.Round(Me.Size.Height * 0.21, 0)), Label1.Font.Style)
        Label1.Location = New Point(Button1.Size.Width + Button3.Size.Width + 14, Me.Size.Height / 2 - Label1.Size.Height / 2)

        'Right
        Button4.Location = New Point(Me.Size.Width - y, 0)
        Button4.Size = New Size(y, y)

        Button2.Size = New Size(y * 0.59, y * 0.59)
        Button2.Location = New Point(Me.Size.Width - (Button4.Size.Width + Button2.Size.Width + 7), Me.Size.Height / 2 - Button1.Size.Height / 2)

        Label2.Font = New Font(Label2.Font.Name, CUInt(Math.Round(Me.Size.Height * 0.21, 0)), Label2.Font.Style)
        Label2.Location = New Point(Button2.Location.X - (7 + Label2.Size.Width), Me.Size.Height / 2 - Label2.Size.Height / 2)
        
        'Points
        Label3.Location = New Point(Me.Size.Width / 2 - Label3.Size.Width / 2, 10)
        Label4.Font = New Font(Label4.Font.Name, CUInt(Math.Round(Me.Size.Height * 0.3, 0)), Label4.Font.Style)
        Label4.Location = New Point(Label3.Location.X - Label4.Size.Width \ 2, 10 + Label3.Height)
        Label5.Font = New Font(Label5.Font.Name, CUInt(Math.Round(Me.Size.Height * 0.3, 0)), Label5.Font.Style)
        Label5.Location = New Point(Label3.Location.X + Label3.Width - Label5.Size.Width \ 2, 10 + Label3.Height)
    End Sub

    Private Sub ChangeLanguage(ByVal lang As String)
        For Each c As Control In Me.Controls
            Dim resources As ComponentResourceManager = New ComponentResourceManager(GetType(Overlay))
            resources.ApplyResources(c, c.Name, New CultureInfo(lang))
        Next c
    End Sub

    Public Sub New()
        MyBase.New()

        If ReadLine(appinfo, 1) <> "" Then
            Threading.Thread.CurrentThread.CurrentUICulture = New Globalization.CultureInfo(ReadLine(appinfo, 1))
        Else
            Threading.Thread.CurrentThread.CurrentUICulture = New Globalization.CultureInfo("en")
        End If
        InitializeComponent()
    End Sub
#End Region
#Region "Player bearbeiten"
    Private Sub Label1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.DoubleClick
        If locked Then
            Label6.Text = "Name Player 1:"
            Panel1.Visible = True
            TextBox1.Visible = True
            ComboBox1.Visible = True
            Button5.Visible = True
            Button6.Visible = True
        End If
    End Sub
    Private Sub Label2_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.DoubleClick
        If locked Then
            Label6.Text = "Name Player 2:"
            TextBox1.Visible = True
            Panel1.Visible = True
            ComboBox1.Visible = True
            Button5.Visible = True
            Button6.Visible = True
        End If
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If Label6.Text = "Custom size" Then
            Dim splitted() As String
            splitted = Split(TextBox1.Text, ",")
            size_custom(splitted(0), splitted(1))
        Else
            name_write()
        End If
        panel_all_hidden()
    End Sub
#End Region
#Region "Punkteanzeige"
    Private Sub Label4_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label4.MouseDown
        If locked Then
            Dim i As Integer = Label4.Text
            If e.Button = MouseButtons.Right Then
                i = i - 1
            Else
                i = i + 1
            End If

            If i >= 0 Then
                Label4.Text = i
            End If
        End If
    End Sub
    Private Sub Label5_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label5.MouseDown
        If locked Then
            Dim i As Integer = Label5.Text
            If e.Button = MouseButtons.Right Then
                i = i - 1
            Else
                i = i + 1
            End If

            If i >= 0 Then
                Label5.Text = i
            End If
        End If
    End Sub
    Private Sub Label5_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label5.MouseUp
        ContextMenuStrip3.Close()
    End Sub
    Private Sub Label4_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label4.MouseUp
        ContextMenuStrip3.Close()
    End Sub
#End Region
#Region "Rassenauswahl"
    Private Sub TerranerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TerranerToolStripMenuItem.Click
        Button3.BackgroundImage = My.Resources.terran_logo

        If Label1.Text <> "Player 1" Then
            Dim i As Integer = 1
            While i <> 0
                If ReadLine(userinfo, i) = Label1.Text Then
                    EditLine(colorinfo, "terran", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If

    End Sub
    Private Sub ProtossToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProtossToolStripMenuItem1.Click
        Button3.BackgroundImage = My.Resources.protoss_logo

        If Label1.Text <> "Player 1" Then
            Dim i As Integer = 1
            While i <> 0
                If ReadLine(userinfo, i) = Label1.Text Then
                    EditLine(colorinfo, "protoss", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If
    End Sub
    Private Sub ZergToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZergToolStripMenuItem1.Click
        Button3.BackgroundImage = My.Resources.zerg_logo

        If Label1.Text <> "Player 1" Then
            Dim i As Integer = 1
            While i <> 0
                If ReadLine(userinfo, i) = Label1.Text Then
                    EditLine(colorinfo, "zerg", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If
    End Sub

    Private Sub TerranToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TerranToolStripMenuItem.Click
        Button4.BackgroundImage = My.Resources.terran_logo

        If Label2.Text <> "Player 2" Then
            Dim i As Integer = 1
            While i <> 0
                If ReadLine(userinfo, i) = Label2.Text Then
                    EditLine(colorinfo, "terran", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If
    End Sub
    Private Sub ProtossToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProtossToolStripMenuItem.Click
        Button4.BackgroundImage = My.Resources.protoss_logo

        If Label2.Text <> "Player 2" Then
            Dim i As Integer = 1
            While i <> 0
                If ReadLine(userinfo, i) = Label2.Text Then
                    EditLine(colorinfo, "protoss", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If
    End Sub
    Private Sub ZergToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZergToolStripMenuItem.Click
        Button4.BackgroundImage = My.Resources.zerg_logo

        If Label2.Text <> "Player 2" Then
            Dim i As Integer = 0
            While i <> 0
                If ReadLine(userinfo, i) = Label2.Text Then
                    EditLine(colorinfo, "zerg", i)
                    Exit While
                End If
                i = i + 1
            End While
        End If
    End Sub
#End Region
#Region "PlayerColorn"
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If locked Then
            Panel1.Visible = True
            TextBox1.Visible = False
            Button7.Visible = True
            Button8.Visible = True
            Button9.Visible = True
            Button10.Visible = True
            Button11.Visible = True
            Button12.Visible = True
            Button13.Visible = True
            Button14.Visible = True
            Label6.Text = "Color Player 1"
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If locked Then
            Panel1.Visible = True
            TextBox1.Visible = False
            Button7.Visible = True
            Button8.Visible = True
            Button9.Visible = True
            Button10.Visible = True
            Button11.Visible = True
            Button12.Visible = True
            Button13.Visible = True
            Button14.Visible = True
            Label6.Text = "Color Player 2"
        End If
    End Sub
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Red
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Red
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Blue
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Blue
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Aqua
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Aqua
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Purple
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Purple
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Yellow
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Yellow
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Orange
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Orange
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.Green
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.Green
        End If
        panel_all_hidden()
    End Sub
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        If Label6.Text = "Color Player 1" Then
            Button1.BackColor = Color.LightPink
        ElseIf Label6.Text = "Color Player 2" Then
            Button2.BackColor = Color.LightPink
        End If
        panel_all_hidden()
    End Sub
#End Region
#Region "Formularposition"
    Private Sub LinksToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinksToolStripMenuItem.Click
        Me.Location = New Point(0, 0)
    End Sub
    Private Sub MitteToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MitteToolStripMenuItem1.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width / 2 - Me.Size.Width / 2, 1)
    End Sub
    Private Sub RechtsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RechtsToolStripMenuItem.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Size.Width, 0)
    End Sub
    Private Sub LinksToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinksToolStripMenuItem1.Click
        Me.Location = New Point(0, My.Computer.Screen.Bounds.Height / 2 - Me.Size.Height / 2)
    End Sub
    Private Sub ZentrumToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZentrumToolStripMenuItem.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width / 2 - Me.Size.Width / 2, My.Computer.Screen.Bounds.Height / 2 - Me.Size.Height / 2)
    End Sub
    Private Sub RechtsToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RechtsToolStripMenuItem1.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width - 500, My.Computer.Screen.Bounds.Height / 2 - Me.Size.Height / 2)
    End Sub
    Private Sub LinksToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinksToolStripMenuItem2.Click
        Me.Location = New Point(0, My.Computer.Screen.Bounds.Height - 50)
    End Sub
    Private Sub ZentrumToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZentrumToolStripMenuItem1.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width / 2 - Me.Size.Width / 2, My.Computer.Screen.Bounds.Height - Me.Size.Height)
    End Sub
    Private Sub RechtsToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RechtsToolStripMenuItem2.Click
        Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Size.Width, My.Computer.Screen.Bounds.Height - Me.Size.Height)
    End Sub
    Private Sub SchließenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SchließenToolStripMenuItem.Click
        Close()
    End Sub
#End Region
#Region "Hintergrund"
    'Hintergrund einstellen
    Private Sub EinstellenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EinstellenToolStripMenuItem.Click
        With OpenFileDialog1
            .Filter = _
            "jpg (*.jpg)|*.jpg|png (*.png)|*.png|gif (*.gif)|*.gif|Alle Dateien (*.*)|*.*"
            .FilterIndex = 1
            .InitialDirectory = "C:\"
            .Title = "Wähle bitte eine Bilddatei aus"
            If .ShowDialog() = Windows.Forms.DialogResult.OK Then
                EditLine(appinfo, .FileName, 2)
                Me.BackgroundImage = System.Drawing.Image.FromFile(ReadLine(appinfo, 2))
            End If
        End With
    End Sub

    'Hintergrund löschen
    Private Sub LöschenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LöschenToolStripMenuItem.Click
        EditLine(appinfo, "", 2)
        Me.BackgroundImage = Nothing
        Me.BackColor = Color.Black
        Panel1.BackColor = Color.Black
    End Sub

    'Transparent
    Private Sub TransparentToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TransparentToolStripMenuItem.Click
        EditLine(appinfo, "", 2)
        Me.BackgroundImage = Nothing
        Me.BackColor = Color.Maroon
        Panel1.BackColor = Color.Maroon
    End Sub
#End Region
#Region "Größe einstellen"
    Private Sub KleinToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KleinToolStripMenuItem.Click
        size_small()
    End Sub

    Private Sub GroßToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroßToolStripMenuItem.Click
        size_big()
    End Sub
#End Region
#Region "Sichtbarkeit"
    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click
        Me.Opacity = 1
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem3.Click
        Me.Opacity = 0.75
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click
        Me.Opacity = 0.5
    End Sub

    Private Sub ToolStripMenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem5.Click
        Me.Opacity = 0.25
    End Sub
#End Region
#Region "Sprache"
    Private Sub GermanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GermanToolStripMenuItem.Click
        If CultureInfo.CurrentUICulture.ToString <> "de" Then
            ChangeLanguage("de")
            Me.Refresh()
            Button3.ContextMenuStrip = Nothing
            Button4.ContextMenuStrip = Nothing
            EditLine(appinfo, "de", 1)
            MsgBox("Sprache gespeichert. Alle Änderungen erst nach einem Neustart des Programms verfügbar.")
        End If
    End Sub

    Private Sub EnglishToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnglishToolStripMenuItem.Click
        If CultureInfo.CurrentUICulture.ToString <> "en" Then
            ChangeLanguage("en")
            Me.Refresh()
            Button3.ContextMenuStrip = Nothing
            Button4.ContextMenuStrip = Nothing
            EditLine(appinfo, "en", 1)
            MsgBox("Language saved. All changes until after a program restart available.")
        End If
    End Sub
#End Region

    'Abbrechbutton
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        panel_all_hidden()
    End Sub

    'Combobox
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        panel_all_hidden()

        Dim i As Integer = 1

        Select Case Label6.Text
            Case "Name Player 1:"
                Label1.Text = ComboBox1.SelectedItem

                While i <> 0
                    If ReadLine(userinfo, i) = Label1.Text Then
                        Select Case ReadLine(colorinfo, i)
                            Case "terran"
                                Button3.BackgroundImage = My.Resources.terran_logo
                            Case "protoss"
                                Button3.BackgroundImage = My.Resources.protoss_logo
                            Case "zerg"
                                Button3.BackgroundImage = My.Resources.zerg_logo
                            Case Else
                                Button3.BackgroundImage = My.Resources.tattoo1_48
                        End Select
                        Button3.ContextMenuStrip = ContextMenuStrip1
                        Exit While
                    End If
                    i = i + 1
                End While

            Case "Name Player 2:"
                Label2.Text = ComboBox1.SelectedItem
                While i <> 0
                    If ReadLine(userinfo, i) = Label2.Text Then
                        Select Case ReadLine(colorinfo, i)
                            Case "terran"
                                Button4.BackgroundImage = My.Resources.terran_logo
                            Case "protoss"
                                Button4.BackgroundImage = My.Resources.protoss_logo
                            Case "zerg"
                                Button4.BackgroundImage = My.Resources.zerg_logo
                            Case Else
                                Button4.BackgroundImage = My.Resources.tattoo1_48
                        End Select
                        Button4.ContextMenuStrip = ContextMenuStrip2
                        Exit While
                    End If
                    i = i + 1
                End While
        End Select
    End Sub

    Private Sub UnlockToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnlockToolStripMenuItem.Click
        If UnlockToolStripMenuItem.Text = "Unlock" Then
            locked = False
            UnlockToolStripMenuItem.Text = "Lock"
        Else
            locked = True
            UnlockToolStripMenuItem.Text = "Unlock"
        End If
    End Sub

    Private Sub CustomToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomToolStripMenuItem.Click
        Label6.Text = "Custom size"
        TextBox1.Text = Me.Size.Width & ", " & Me.Size.Height

        Panel1.Visible = True
        TextBox1.Visible = True
        Label6.Visible = True
        Button5.Visible = True
        Button6.Visible = True
    End Sub


#Region "CutOuts"
    'Private Sub LastSettingsLoadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LastSettingsLoadToolStripMenuItem.Click
    '    If ReadLine(appinfo, 3) <> "" Then
    '        Dim splitted() As String

    '        'Form
    '        splitted = Split(ReadLine(appinfo, 3), ",")
    '        Me.Size = New Size(splitted(0), splitted(1))

    '        splitted = Split(ReadLine(appinfo, 4), ",")
    '        Me.Location = New Point(splitted(0), splitted(1))

    '        Me.Opacity = ReadLine(appinfo, 9)

    '        'Player left
    '        splitted = Split(ReadLine(appinfo, 5), ",")
    '        Label1.Location = New Point(splitted(0), splitted(1))
    '        Label1.Font = New Font(Label1.Font.Name, CUInt(ReadLine(appinfo, 14)), Label1.Font.Style)

    '        'Player right
    '        splitted = Split(ReadLine(appinfo, 6), ",")
    '        Label2.Location = New Point(splitted(0), splitted(1))
    '        Label2.Font = New Font(Label2.Font.Name, CUInt(ReadLine(appinfo, 15)), Label2.Font.Style)

    '        'Colorpick left
    '        splitted = Split(ReadLine(appinfo, 7), ",")
    '        Button1.Size = New Size(ReadLine(appinfo, 16), ReadLine(appinfo, 16))
    '        Button1.Location = New Point(splitted(0), splitted(1))

    '        'Colorpick right
    '        splitted = Split(ReadLine(appinfo, 8), ",")
    '        Button2.Size = New Size(ReadLine(appinfo, 17), ReadLine(appinfo, 17))
    '        Button2.Location = New Point(splitted(0), splitted(1))

    '        'Racepick left
    '        Button3.Size = New Size(Me.Size.Height, Me.Size.Height)
    '        Button3.Location = New Point(0, 0)

    '        'Racepick right
    '        Button4.Size = New Size(Me.Size.Height, Me.Size.Height)
    '        Button4.Location = New Point(Me.Size.Width - Button4.Size.Width, 0)

    '        'Points
    '        splitted = Split(ReadLine(appinfo, 11), ",")
    '        Label3.Location = New Point(splitted(0), splitted(1))

    '        splitted = Split(ReadLine(appinfo, 12), ",")
    '        Label4.Location = New Point(splitted(0), splitted(1))
    '        Label4.Font = New Font(Label4.Font.Name, CUInt(ReadLine(appinfo, 18)), Label4.Font.Style)

    '        splitted = Split(ReadLine(appinfo, 13), ",")
    '        Label5.Location = New Point(splitted(0), splitted(1))
    '        Label5.Font = New Font(Label5.Font.Name, CUInt(ReadLine(appinfo, 18)), Label5.Font.Style)
    '    End If
    'End Sub
#End Region
End Class
